﻿// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated>
#nullable disable
using System;
using System.Collections.Generic;

namespace WpfApp1.Models
{
    /// <summary>
    /// Модель, описывающая поступления товаров на склады.
    /// </summary>
    public partial class ReceiptOfProductsToStorages : ICopied<ReceiptOfProductsToStorages>
    {
        public int Id { get; set; }
        public int ProductId { get; set; }
        public int StorageId { get; set; }

        private DateTime? _receivedAt;
        public DateTime ReceivedAt 
        { 
            get
            {
                return _receivedAt ?? DateTime.Now;
            }
            set
            {
                _receivedAt = value;
            }
        }

        public int Amount { get; set; }

        public virtual Products Product { get; set; }
        public virtual Storages Storage { get; set; }

        public ReceiptOfProductsToStorages Clone()
        {
            ReceiptOfProductsToStorages receiptOfProductsToStorages = new ReceiptOfProductsToStorages();
            receiptOfProductsToStorages.Id = Id;
            receiptOfProductsToStorages.ProductId = ProductId;
            receiptOfProductsToStorages.StorageId = StorageId;
            receiptOfProductsToStorages.ReceivedAt = ReceivedAt;
            receiptOfProductsToStorages.Amount = Amount;
            receiptOfProductsToStorages.Product = Product;
            receiptOfProductsToStorages.Storage = Storage; 
            return receiptOfProductsToStorages;
        }

        public void Copy(ReceiptOfProductsToStorages receiptOfProductsToStorages)
        {
            Id = receiptOfProductsToStorages.Id;
            ProductId = receiptOfProductsToStorages.ProductId;
            StorageId = receiptOfProductsToStorages.StorageId;
            ReceivedAt = receiptOfProductsToStorages.ReceivedAt;
            Amount = receiptOfProductsToStorages.Amount;
            Product = receiptOfProductsToStorages.Product;
            Storage = receiptOfProductsToStorages.Storage;
        }
    }
}